package com.blog.admin.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 * oss配置类
 * </p>
 *
 * @author Valerie
 * @date 2023/3/13
 **/
@EnableConfigurationProperties(OssConfiguration.class)
@Configuration
public class OssConfig {

    @Bean
    public OSS oss(OssConfiguration ossConfiguration){
        return new OSSClientBuilder().build(ossConfiguration.getEndpoint(), ossConfiguration.getAccessKeyId(), ossConfiguration.getAccessKeySecret());
    }
}
